package com.yanqu.road.server.cmd.activity.ppl;

import com.yanqu.road.entity.activity.ppl.PplShootResult;
//import com.yanqu.road.logic.pb.PplPb;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * 第一版中途就废弃了，不再用这个了
 */
@Cmd(code = GameProtocol.S_ACTIVITY_PPL_SHOOT_BALL, desc = "泡泡龙发射球")
public class ShootBallCmd extends AbstractCommand {

    private int x;
    private int y;

    private PplShootResult result;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        /*
        PplProto.ShootBallReqMsg reqMsg = PplProto.ShootBallReqMsg.parseFrom(packet.getBytes());
        x = reqMsg.getX();
        y = reqMsg.getY();
        */
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        /*
        if (!PplMgr.isActivityInTime()) {
            ret = GameErrorCode.E_ACTIVITY_PPL_NO_IN_TIME;
            return;
        }
        PplModule pplModule = player.getModule(PplModule.class);
        pplModule.checkEnergyRecovery();
        pplModule.checkMaxY();
        if (!pplModule.isBeautyChosen()) {
            ret = GameErrorCode.E_ACTIVITY_PPL_BEAUTY_NO_CHOSEN;
            return;
        }
        if (!pplModule.isEnergyEnough()) {
            ret = GameErrorCode.E_ACTIVITY_PPL_ENERGY_NO_ENOUGH;
            return;
        }

        result = pplModule.shootBall(x, y);
        ret = result.getRet();
        */
    }

    @Override
    public void sendData(GamePlayer player) {
        /*
        PplProto.ShootBallRespMsg.Builder builder;
        if (ret == 0) {
            builder = PplPb.parseShootBallRespMsg(player.getModule(PplModule.class).getUserData(), result);
        } else {
            builder = PplProto.ShootBallRespMsg.newBuilder();
            builder.setRet(ret);
        }
        player.sendChannelPacket(ClientProtocol.U_ACTIVITY_PPL_SHOOT_BALL, builder);
        */
    }
}
